package com.sbdev.dic;


public enum SexEnum {

    MALE(0, "男"),
    FEMALE(1, "女");

    private Integer id;
    private String value;
    SexEnum(Integer id, String value) {
        this.id = id;
        this.value = value;
    }

    /**
     * 获取根据编号获取性别枚举
     * @param id 编号
     * @return 枚举
     */
    public static SexEnum getSexEnum(Integer id) {
        for (SexEnum sex : SexEnum.values()) {
            if (sex.getId().equals(id)) {
                return  sex;
            }
        }
        return null;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
